package me.zhengjie.modules.fund.domain;

import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import me.zhengjie.base.BaseEntity;

import javax.persistence.*;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

@Entity
@Getter
@Setter
@Table(name = "user_stock")
public class UserStock extends BaseEntity implements Serializable {

    private static final long serialVersionUID = 5999729571297529401L;

    @Id
    @Column(name = "id")
    @NotNull(groups = Update.class)
    @ApiModelProperty(value = "ID", hidden = true)
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    @ApiModelProperty(value = "用户ID")
    private Long userId;

    @NotBlank
    @ApiModelProperty(value = "股票代码")
    private String stockCode;

    @ApiModelProperty(value = "股票名称")
    private String stockName;

    @NotNull
    @ApiModelProperty(value = "购买渠道 1：中信建投 2 华泰证券")
    private Integer purchaseChannel;

    @NotNull
    @ApiModelProperty(value = "持有份额")
    private BigDecimal count;

    @NotNull
    @ApiModelProperty(value = "股票成本")
    private BigDecimal principalNetValue;

    @ApiModelProperty(value = "成本金额")
    private BigDecimal principalAmount;

    @ApiModelProperty(value = "最新净值")
    private BigDecimal newestNetValue;

    @ApiModelProperty(value = "持仓金额（以最新净值计算)")
    private BigDecimal newestAmount;

    @ApiModelProperty(value = "最新净值更新时间")
    private Date newestUpdatedDate;
}
